﻿using System;

using UnityEngine;

/// <summary>
/// 技能触发条件的抽象基类
/// </summary>
public abstract class PerkCondition
{
    /// <summary>
    /// 条件触发的时机配置
    /// [SerializeField]标记使其可在Unity编辑器中配置
    /// </summary>
    [field: SerializeField] protected ReactionTiming reactionTiming;

    /// <summary>
    /// 订阅条件触发时的回调方法
    /// </summary>
    /// <param name="reaction">条件满足时要执行的回调方法，接收GameAction参数</param>
    public abstract void SubscribeCondition(Action<GameAction> reaction);

    /// <summary>
    /// 取消订阅条件回调
    /// </summary>
    /// <param name="reaction">要移除的回调方法</param>
    public abstract void UnsubscribeCondition(Action<GameAction> reaction);

    /// <summary>
    /// 检查子条件是否满足
    /// </summary>
    /// <param name="gameAction">要检查的游戏动作</param>
    /// <returns>如果所有子条件都满足返回true，否则false</returns>
    public abstract bool SubConditionIsMet(GameAction gameAction);
}